Description:
This sample gets a reference to the selected feature's recordset and displays the value of the first attribute in a message box.
How to use:
- Select a feature in the map.
- Paste the JScript or VBScript code into the Script dialog box (depending on which language is set as the default scripting language).
- Click/Tap the Execute icon.
JScript
Copy Code | |
---|---|
function GetSelected() { var pRS; if (Map.SelectionLayer == null) return; pRS = Map.SelectionLayer.Records; pRS.Bookmark = Map.SelectionBookmark; Application.MessageBox (pRS.Fields(1).Value.toString()); pRS = null; } GetSelected(); |
VBScript
Copy Code | |
---|---|
Sub GetSelected() Dim pRS If (Map.SelectionLayer Is Nothing) Then Exit Sub Set pRS = Map.SelectionLayer.Records pRS.Bookmark = Map.SelectionBookmark Application.MessageBox CStr(pRS.Fields(1).Value) Set pRS = Nothing End Sub Call GetSelected() |